package com.juc.function;

import java.util.function.Predicate;

/**
 * @author yuanzheng
 * @date 2020/8/14-13:30
 */
public class Demo2 {
    public static void main(String[] args) {
        // 简化前
        Predicate<String> predicate1 = new Predicate<String>() {
            @Override
            public boolean test(String str) {
                return str.isEmpty();
            }
        };
        //简化后
        Predicate<String> predicate2 = String::isEmpty;
        System.out.println(predicate1.test("a"));
        System.out.println(predicate2.test(""));
    }
}
